/* function TreeNode(x) {
    this.val = x;
    this.left = null;
    this.right = null;
} */
function Mirror(root) {
  if (root == null) {
    return;
  }
  function dfs(node) {
    if (node.left != null) {
      dfs(node.left);
    }
    if (node.right != null) {
      dfs(node.right);
    }

    let temp = node.right;
    node.right = node.left;
    node.left = temp;
  }

  dfs(root);
}
